// 	ID : pallab81
// 	PROG : 231
// 	LANG : C++
// 	2011-08-24-17.08.01 Wednesday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,ed) for(int i = 0 ; i < ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ){
    double endtime = clock() + ( seconds*CLOCKS_PER_SEC );
    while( clock() < endtime ){;}
}
int cases;
int H;
vector< int > h;
vector< int > lst;
int N;
inline void Read(){
    h.clear();
    h.pb(H);
    while( CI(H) ){
        if(H==-1)break;
        h.pb( H );
    }
    N = SZ(h);
}


inline void Proc(){
    reverse(h.begin(),h.end());
    lst.clear();
    fo(i,N){
        lst.pb(1);
    }

    for(int i=1;i<N;++i){
        for(int j=0;j<i;++j){
            if( h[i] > h[j] && lst[i] < lst[j] +1 ){
                lst[i]=lst[j]+1;
            }
        }
    }
    int maxx = 0;
    for(int i=0;i<N;++i){
        if( maxx < lst[i] ){
            maxx = lst[i];
        }
    }
    if(cases!=1){
        printf("\n");
    }
    printf("Test #%d:\n",cases);
    printf("  maximum possible interceptions: %d\n",maxx);

}
int main(){
//    #ifndef ONLINE_JUDGE
//        freopen("in.txt","rt",stdin);
//    #endif
    cases=1;
    while( true ){
        CI(H);
        if(H==-1)break;
        Read();
        Proc();
        ++cases;
    }

return 0;
}


